package main

import (
	"encoding/json"
	"fmt"
	"log"
	"log-agent/conf"
	"log-agent/etcd"
)

const (
	logCollectKey = "log_collect_key"
)

func main() {
	value, err := etcd.Get(logCollectKey)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println(string(value))

	var pairs = make([]*conf.Pair, 10)
	err = json.Unmarshal(value, &pairs)
	if err != nil {
		log.Fatalln(err)
	}
	for _, pair := range pairs {
		fmt.Println(pair)
	}
	//values := etcd.Watch("log_collect_key")
	//for value := range values {
	//	fmt.Printf("状态变更: key = %s, value = %s\n",
	//		"q1mi", value)
	//}
}
